BCAITS 权实研读系统 Upaya-Truth Suite v1.0 说明
BCAITS Upaya-Truth Suite v1.0 (BCAITS 权实研读系统)
A Dual-Engine AI Framework for Buddhist Canonical Studies & Zen Hermeneutics
佛典AI研读的基础设施：从“善巧方便”到“学术实相”的双轨系统

📖 Introduction / 简介
BCAITS Upaya-Truth Suite v1.0 is a scalable, open-source AI processing framework designed for Buddhist Digital Humanities. Unlike generic translation tools, this suite is engineered with a specific hermeneutic architecture inspired by the Buddhist principle of "Upaya" (Skillful Means) and "Truth" (Ultimate Reality).

It consists of two specialized applications that leverage Large Language Models (LLMs) with distinct inference parameters (Temperature) and prompt engineering strategies to serve different research needs: from the intuitive realization of Zen Koans to the rigorous philological analysis of Canonical texts.

BCAITS 权实研读系统 v1.0 是一个专为数字佛学人文学科设计的开源 AI 处理框架。与通用的翻译工具不同，本套件基于佛教判教思想中的**“权”（善巧方便）与“实”（真实义理）**构建了双轨架构。

该系统包含两个独立的应用程序，通过差异化的推理温度（Temperature）与提示工程策略，分别服务于不同的研读需求：从禅宗公案的直觉参悟，到经律论文献的严谨考据。

🛠️ System Architecture / 系统架构
1. BCAITS Upaya (The Skillful) | 权智·禅宗善巧系统
Version: v14.0
Logic: High Temperature (0.7) - Creative & Intuitive.
Focus: Zen Koans (e.g., Records of the Lamp).
Methodology: Integrates Cognitive Science (Embodied Cognition) and modern scientific metaphors (e.g., Quantum Mechanics) to translate ancient koans into accessible modern experiences.
定位: 高热度推理（灵动）。侧重于禅宗公案，结合认知科学与现代隐喻，旨在通过“善巧方便”引发读者的直觉性参悟，重在“意象”与“心流”。
2. BCAITS Truth (The Actual) | 实相·佛典考据系统
Version: v1.1
Logic: Low Temperature (0.3) - Rigorous & Consistent.
Focus: Canonical Literature (Sutras, Vinaya, Abhidharma, Commentaries).
Methodology: Emphasizes Philology, Structural Analysis (Pan-jiao/Ke-pan), and terminology standardization. It minimizes AI hallucination to provide a reliable basis for scholarly study.
定位: 低热度推理（严谨）。侧重于经律论义理，强调文献学考据、科判结构分析（章句切分）与名相释义，最大限度减少AI幻觉，服务于严肃的学术梳理。
🌍 Multilingual Matrix / 多语言矩阵
Both systems support automatic segmentation and generation of separate files and contrast study editions in 12 languages, forming a "6x2" symmetrical linguistic matrix:

两个系统均支持 12 种语言 的独立文件生成与对照研读版自动生成，形成了“6x2”的完美对称矩阵：

Chinese (中文)
English (英文)
Japanese (日本語)
Korean (한국어)
Tibetan (བོད་ཡིག)
Pāli (Romanized)
Spanish (Español)
Russian (Русский)
French (Français)
German (Deutsch)
Hindi (हिन्दी)
Norwegian (Norsk)
⚠️ Critical Technical Note / 关键技术说明
Regarding Text Segmentation (关于文本分段):

This software includes a built-in ZenTextProcessor class, which uses Regular Expressions (Regex) to automatically segment raw text.

Current Optimization: The segmentation logic is currently optimized specifically for the text structure of "Wudeng Huiyuan" (X80n1565) (e.g., detecting headers like "Chan Master", "Volume", "Case").
Limitation: If your input text does not share a similar structure to Wudeng Huiyuan, the automatic segmentation may fail or function sub-optimally.
Usage: This program is provided as a framework/sample. Researchers are expected to modify the regex patterns in the source code or integrate their own AI segmentation models to adapt to different corpora.
关于分段算法的局限性：

本软件内置了 ZenTextProcessor 类，使用正则表达式对原始文本进行自动分段。

当前优化：目前的分段逻辑是专门针对**《五灯会元》(X80n1565)** 的文本结构（如“禅师”、“卷”、“则”等标题格式）进行优化的。
局限声明：如果您的输入文本结构与《五灯会元》差异较大，自动分段功能可能失效或效果不佳。
使用建议：本程序仅作为框架/样例提供。研究者需根据自身研究的文献类型，修改源代码中的正则规则，或接入自定义的AI分段模型以适配新文本。
🚀 Usage Guide / 使用指南
1. Prerequisites / 环境准备
Python: Download and install Python 3.x from python.org. Ensure "Add Python to PATH" is checked during installation.
Dependencies: Open your Terminal/Command Prompt and install the required library:
pip install requests
2. Running the Software / 运行软件
For Zen/Koan Study: Run BCAITS_Upaya_v14.0.py
For Scholarly/Canon Study: Run BCAITS_Truth_v1.1.py
3. Configuration / 配置步骤
API Setup: Upon launching, locate the "API URL" and "API Key" fields at the top.
Note: For security reasons, default keys have been removed. You must enter your own OpenAI-compatible API key.
Load Text: Click "Select File" (📂 选择文件) to load your source .txt file.
Tip: You can use a sample excerpt from Wudeng Huiyuan to test the segmentation.
Select Tasks: Check the boxes for the desired languages and task types (Translation / Exegesis).
Execute: Click "Start" (🚀 启动任务). The system will generate:
_split.txt: The raw segmented text.
_[Lang].txt: Individual translation/exegesis files.
_Contrast.[Lang].txt: The combined study edition.
📄 License & Citation / 许可与引用
License: MIT License (Open Source)
Citation: Please cite this repository if you use the BCAITS framework for your research or digital humanities projects.



🇨🇳 中文说明 (Chinese)
简介：
本软件用于特定文献X80n1565五灯会元.txt专用的禅宗文本自动分段，并生成汉、英、日、韩、藏、巴利六种语言的深度评注（结合中观、如来藏与现代科学隐喻）。
读者可以选取五灯会元中的段落，制成txt来测试使用。
但并没有运行到底，如果不是五灯会元的类似结构，分段可能无法运行，要使用读者自己的AI来训连新的分段基础，修改程序，否则无法有效运行。
这个程序仅仅作为样例，可以用来扩展AI的API运用，发展各种类型的评注，翻译，或其他需要的文本。


### Translations in Six Languages

#### 1. English
This software is designed for automatic segmentation of Zen texts specifically from the document X80n1565 "Wudeng Huiyuan.txt" (Records of the Transmission of the Lamp), and generates in-depth commentaries in six languages: Chinese, English, Japanese, Korean, Tibetan, and Pāli (incorporating metaphors from Madhyamaka, Tathāgatagarbha, and modern science).  
Readers can select passages from the Wudeng Huiyuan, save them as a .txt file, and test the software.  
However, it has not been fully optimized; if the text structure is not similar to that of the Wudeng Huiyuan, segmentation may fail. Users must train their own AI on a new segmentation base and modify the program accordingly; otherwise, it will not run effectively.  
This program is provided merely as a sample and can be extended for various AI API applications, developing different types of commentaries, translations, or other required texts.

#### 2. Japanese (日本語)
本ソフトウェアは、特定の文献X80n1565「五灯会元.txt」専用の禅宗テキストの自動分段に使用され、中国語、英語、日本語、韓国語、チベット語、パーリ語の6言語による深い注釈を生成します（中観、如来蔵、現代科学のメタファーを組み合わせ）。  
読者は五灯会元から段落を選択し、txtファイルとして保存してテスト使用できます。  
しかし、完全に最適化されているわけではなく、五灯会元と類似の構造でない場合、分段が失敗する可能性があります。読者自身が新しい分段基盤をAIで訓練し、プログラムを修正する必要があります。そうしないと効果的に動作しません。  
このプログラムはサンプルとして提供されており、さまざまなAI APIの応用を拡張し、異なる種類の注釈、翻訳、または他の必要なテキストを開発できます。

#### 3. Korean (한국어)
이 소프트웨어는 특정 문헌 X80n1565 "오등회원.txt" 전용으로 선종 텍스트를 자동 분단하며, 한어, 영어, 일어, 한국어, 티베트어, 팔리어 6개 언어로 깊은 주석을 생성합니다 (중관, 여래장과 현대 과학의 비유를 결합).  
독자는 오등회원에서 단락을 선택하여 txt 파일로 만들어 테스트 사용할 수 있습니다.  
그러나 완전히 최적화되지 않았으며, 오등회원과 유사한 구조가 아니면 분단이 실패할 수 있습니다. 독자 자신의 AI로 새로운 분단 기반을 훈련하고 프로그램을 수정해야 합니다. 그렇지 않으면 효과적으로 작동하지 않습니다.  
이 프로그램은 샘플로만 제공되며, 다양한 AI API 응용을 확장하여 여러 유형의 주석, 번역, 또는 다른 필요한 텍스트를 개발할 수 있습니다.

#### 4. Tibetan (བོད་ཡིག)
འདིའི་ཉེར་མཁོ་འདི་ནི་ཡིག་ཆ་གཅིག་ཁྲོད་ཀྱི་ཁྲིམས་སྡེ་ཨེགས་80n1565 ལྷ་གཅིག་གི་ལྡན་པའི་རྩོམ་ཡིག་.txt ལ་གཏོགས་པའི་ཆན་རིག་གི་ཡིག་ཆ་རང་བཞིན་གྱི་ཆ་ཤས་སུ་འབྱེད་པ་དང་། རྒྱ་ཡིག་། དབྱིན་ཡིག་། ཉི་ཧོང་ཡིག་། ལྷོ་རིག་ཡིག་། བོད་ཡིག་། པ་ལི་ཡིག་གི་ཡིག་སྐད་དྲུག་གི་གཏིང་ཟབ་ཀྱི་མཆན་འགྲེལ་སྐྱེད་སྟངས་ཡིན།（དབུ་མ་དང་རྗེ་བཙན་སྙིང་པོ་དང་དེང་རབས་ཚན་རིག་གི་གཏམ་དཔེ་སྦྱར་ནས།）  
ཁྲིམས་སྡེ་ལྷ་གཅིག་གི་ལྡན་པའི་ཆ་ཤས་འདེམས་ནས་ txt ཡིག་ཆ་སུ་བཟོས་ཏེ་ལེགས་སྦྱར་ལ་ལྟ་རྟོག་བྱེད་ཐུབ།  
ཡིན་ནའང་མཐའ་རུ་མ་འགྲོ་བ་ཡིན་པས། ལྷ་གཅིག་གི་ལྡན་པ་དང་མཚུངས་པའི་གོ་རིམ་མེད་ན་ཆ་ཤས་འབྱེད་མི་ཐུབ་པའི་གནས་ཚུལ་ཡོད། ལྟ་རྟོག་པོའི་ཨེ་ཨའི་རང་གིས་ཆ་ཤས་འབྱེད་པའི་གཞི་རྟེན་གསར་པ་སྦྱངས་ནས་ལས་རིམ་ལེགས་བཅོས་བྱས་དགོས། དེ་མི་བྱས་ན་ལེགས་པར་འགྲོ་མི་ཐུབ།  
ལས་རིམ་འདི་ནི་དཔེ་མཚོན་ཙམ་ཡིན་པས། ཨེ་ཨའི་ཨེ་པི་ཨའི་ལག་ལེན་རྒྱ་ཆེར་སྤེལ་བ་ལ་ལག་ལེན་བྱེད་ཐུབ། མཆན་འགྲེལ་རིགས་སོ་སོ། འགྱུར་བ། ཡང་ན་ཡིག་ཆ་གཞན་དག་ལ་ལག་ལེན་བྱེད་ཐུབ།

#### 5. Pāli (Romanized Pāli with Script)
**Romanized Pāli**:
Ayaṃ software visesaṃ X80n1565 Pañcadīpikāsaṅgaha.txt nāma Chan-zong pāṭhaṃ visesaṃ vibhajati, tathā ca Chaḷabhāṣāsu (Cīna-bhāṣā, Aṅgabhāṣā, Nippon-bhāṣā, Koria-bhāṣā, Bodhi-bhāṣā, Pāli-bhāṣā) gambhīra-aṭṭhakathā janeti (Madhyamaka, Tathāgatagarbha, ādhunika-vijñāna-upamāhi saha).

Pāṭhakā Pañcadīpikāsaṅgahato khaṇḍaṃ gahetvā txt rūpena parikkhitvā upayojetuṃ sakkonti.

Kintu na sampuṇṇaṃ yāva, yadi Pañcadīpikāsaṅgaha-sadisa-racanā na hoti, vibhajanaṃ na sakkoti kātuṃ, pāṭhakassa nijassa AI-dvāra vibhajana-mūlaṃ sikkhitvā program parivattetuṃ vā, na hi tathā sakkoti kātuṃ.

Ayaṃ program kevalaṃ udāharaṇa-mattaṃ, AI API upayogaṃ vitthāretuṃ sakkoti, vividha-aṭṭhakathā, anuvāda, atha vā añña-yācitaka-pāṭha janetuṃ.

**Pāli Script** (for reference, using standard Unicode Pāli):
အယံ ဆော့ဖ်ဝဲရေ ဝိသေသံ X80n1565 ပဉ္စဒီပိကာသံဂဟ.txt နာမ ဆန်-ဇောင် ပါဌ ဝိသေသံ ဝိဘဇ္ဇတိ၊ တထာ စ ဆဠဘာသာသု (စီန-ဘာသာ၊ အံဂဘာသာ၊ နိပ္ပုန်-ဘာသာ၊ ကိုရီယာ-ဘာသာ၊ ဗောဓိ-ဘာသာ၊ ပါဠိ-ဘာသာ) ဂမ္ဘီရ-အဋ္ဌကထာ ဇနေတိ (မဓ္ယမက၊ တထာဂတဂဗ္ဘ၊ အာဓုနိက-ဝိဇ္ဇာန-ဥပမာဟိ သဟ)။

ပါဌကာ ပဉ္စဒီပိကာသံဂဟတော ခဏ္ဍံ ဂဟေတွာ txt ရုပေန ပရိက္ခိတွာ ဥပယောဇေတုံ သက္ကောန္တိ။

ကိန္တု န သမ္ပုဏ္ဏံ ယာဝ၊ ယဒိ ပဉ္စဒီပိကာသံဂဟ-သဒိသ-ရစနာ န ဟောတိ၊ ဝိဘဇနံ န သက္ကောတိ ကာတုံ၊ ပါဌကဿ နိဇဿ AI-ဒွာရ ဝိဘဇန-မူလံ သိက္ခိတွာ ပြဂ္ဂမ် ပရိဝတ္တေတုံ ဝါ၊ န ဟိ တထာ သက္ကောတိ ကာတုံ။

အယံ ပြဂ္ဂမ် ကေဝလံ ဥဒါဟရဏ-မတ္တံ၊ AI API ဥပယောဂံ ဝိတ္ထာရေတုံ သက္ကောတိ၊ ဝိဝိဓ-အဋ္ဌကထာ၊ အနုဝါဒ၊ အထ ဝါ အည-ယာစိတက-ပါဌ ဇနေတုံ။

（Note: Pāli translations are provided in Romanized form for readability, with a sample in Myanmar script as commonly used in Theravāda contexts. Full native script rendering may vary by region.）

If you need adjustments or more context for any translation, let me know! 🙏


如何使用：

安装 Python：
请访问 python.org 下载并安装最新版 Python（安装时请勾选 "Add Python to PATH"）。
安装依赖库：
在电脑上打开终端（CMD 或 PowerShell），输入以下命令并回车：
pip install requests
运行程序：
双击运行 BCAITS Zen Insight .py  BCAITS Canon Architect .py 文件。
配置 API：
程序启动后，在顶部的 "API URL" 和 "API Key" 输入框中，填入您的 AI 服务商提供的地址和密钥（支持 OpenAI 格式）。
注意：为了安全，发布版本已清空默认密钥，您必须填入自己的密钥才能使用。
开始评注：
点击“选择文件”导入您的 txt 文本，勾选需要的语言，点击“启动”即可。
🇺🇸 English Instructions (English)
Introduction:
This tool automatically segments Zen Buddhist texts (like Goto Egen) and generates deep commentaries in 6 languages (Chinese, English, Japanese, Korean, Tibetan, Pali), integrating Madhyamaka philosophy with Quantum Physics metaphors.

How to Use:

Install Python:
Download and install Python from python.org. Make sure to check "Add Python to PATH" during installation.
Install Dependencies:
Open your terminal (Command Prompt) and run:
pip install requests
Run the Software:
Double-click the BCAITS Zen Insight .py  BCAITS Canon Architect .py file.
Configure API:
Once opened, find the "API URL" and "API Key" fields at the top.
Enter your own API Endpoint and Key (OpenAI-compatible).
Note: Specific keys have been removed for security. You must provide your own.
Start Annotation:
Select your source text file, choose desired output languages, and click "Start".
🇯🇵 日本語説明 (Japanese)
概要：
本ソフトウェアは、禅宗文献（『五灯会元』など）を自動的に分割し、中観・如来蔵思想と現代科学の比喩を融合させた詳細な評注を6カ国語（中・英・日・韓・蔵・巴）で生成します。

使用方法：

Pythonのインストール：
python.org からPythonをダウンロードしてインストールしてください（インストール時に "Add Python to PATH" にチェックを入れてください）。
ライブラリのインストール：
コマンドプロンプト（CMD）を開き、以下のコマンドを入力して実行します：
pip install requests
ソフトの起動：
BCAITS Zen Insight .py  BCAITS Canon Architect .py ファイルをダブルクリックします。
APIの設定：
起動後、画面上部の "API URL" と "API Key" 欄に、ご利用のAIプロバイダーのアドレスとキーを入力してください。
注意：セキュリティのため、デフォルトのキーは削除されています。ご自身のキーを入力する必要があります。
実行：
テキストファイルを選択し、出力したい言語にチェックを入れ、「実行開始」をクリックしてください。
🇰🇷 한국어 설명 (Korean)
소개:
이 프로그램은 선종 문헌(오등회원 등)을 자동으로 분할하고, 중관/여래장 사상과 양자 물리학의 비유를 결합한 깊이 있는 평석을 6개 국어(중·영·일·한·티·팔)로 생성합니다.

사용법:

Python 설치:
python.org 에서 파이썬을 다운로드하여 설치하십시오 ("Add Python to PATH" 체크 필수).
라이브러리 설치:
명령 프롬프트(CMD)를 열고 다음 명령어를 입력하십시오:
pip install requests
프로그램 실행:
BCAITS Zen Insight .py  BCAITS Canon Architect .py 파일을 더블 클릭하십시오.
API 설정:
프로그램 상단의 "API URL" 및 "API Key" 입력란에 본인의 AI 서비스 주소와 키를 입력하십시오.
주의: 보안을 위해 기본 키는 삭제되었습니다. 본인의 키를 사용해야 합니다.
시작:
텍스트 파일을 선택하고 원하는 언어를 체크한 후 "시작" 버튼을 누르십시오.
བོད་ཡིག (Tibetan)
ངོ་སྤྲོད།:
མཉེན་ཆས་འདིས་ནི་རྒྱ་ནག་གི་སྒོམ་ཆེན་གྱི་གསུང་རབ་རྣམས་རང་འགུལ་གྱིས་དུམ་བུར་བགོས་ཏེ། དབུ་མ་དང་སྙིང་པོའི་དོན་རྣམས་དེང་རབས་ཚན་རིག་དང་སྦྱར་ནས་སྐད་ཡིག་དྲུག་གི་ཐོག་ནས་འགྲེལ་བཤད་ཟབ་མོ་འབྲི་ཐུབ།

ལག་ལེན་བསྟར་ཚུལ།:

Python འཇུག་པ།:
python.org ནས་ Python ཕབ་ལེན་བྱས་ཏེ་གློག་ཀླད་ནང་དུ་འཇུག་དགོས། ("Add Python to PATH" ཞེས་པ་དེ་ངེས་པར་དུ་འདེམས་དགོས།)
མཁོ་ཆས་འཇུག་པ།:
CMD ནང་དུ་ pip install requests ཞེས་བྲིས་ནས་ནོན་དགོས།
མཉེན་ཆས་སྒོ་འབྱེད་པ།:
BCAITS Zen Insight .py  BCAITS Canon Architect .py ཞེས་པ་དེར་ཐེངས་གཉིས་ནོན་དང་སྒོ་འབྱེད་ངེས་ཡིན།
API སྒྲིག་བཟོ།:
མཉེན་ཆས་ཀྱི་སྟེང་ངོས་སུ་ "API URL" དང་ "API Key" ཞེས་པའི་ནང་དུ་ཁྱེད་རང་གི་ AI ལྡེ་མིག་ (Key) དེ་འཇུག་དགོས།
འགོ་འཛུགས་པ།:
ཡིག་ཆ་བདམས་ནས་ "Start" མཐེབ་གནོན་དེ་ནོན་དགོས།
🪷 Pāḷi (Romanized)
Nidāna:
Idaṃ yantavidhānaṃ Zen-pāḷiganthe vibhajati, Madhyamaka-Tathāgatagarbha-Quantum-ñāṇena ca cha-bhāsāhi (Cīna, Aṅgaja, Japāna, Korya, Bhoṭa, Pāḷi) gambhīra-aṭṭhakathaṃ karoti.

Upadesa:

Python Patiṭṭhāpana:
python.org to Python-yantraṃ otāretvā patiṭṭhāpehi. (Tatra "Add Python to PATH" lakkhane cihnaṃ karohi).
Upakaraṇa Patiṭṭhāpana:
Terminal-mukhadvāre imaṃ dīpehi:
pip install requests
Yantrappavattana:
BCAITS Zen Insight .py  BCAITS Canon Architect .py nāmake patte dvikkhattuṃ koṭṭehi.
API Vidhāna:
Mukha-dvāre "API URL" ca "API Key" ṭhānesu attano AI-saṅketaṃ (Key) pūrehi.
Sallakkhana: Pākatiya-saṅketo apanīto. Attano saṅketo dātabbo.
Ārambha:
Mūla-gandhaṃ uccinitvā, bhāsāyo rocetvā, "Start" koṭṭehi.


